home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Viewers / pCD0.3.4 / Source / Photo_CD.subproj / pcd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-12  |  2.3 KB  |  105 lines

  1. typedef unsigned char uBYTE;
  2. typedef unsigned long dim;
  3.  
  4. #define BaseW ((dim)768)
  5. #define BaseH ((dim)512)
  6.  
  7. #define SECSIZE 0x800
  8.  
  9.  
  10.  
  11. #define SeHead   2
  12. #define L_Head   (1+SeHead)
  13.  
  14. #define SeBase16 18
  15. #define L_Base16 (1+SeBase16)
  16.  
  17. #define SeBase4  72
  18. #define L_Base4  (1+SeBase4)
  19.  
  20. #define SeBase   288
  21. #define L_Base   (1+SeBase)
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. enum ERRORS { E_NONE,E_READ,E_WRITE,E_INTERN,E_ARG,E_OPT,E_MEM,E_HUFF,
  29.              E_SEQ,E_SEQ1,E_SEQ2,E_SEQ3,E_SEQ4,E_SEQ5,E_SEQ6,E_SEQ7,E_POS,E_IMP, E_TCANT };
  30.  
  31. enum TURNS  { T_NONE,T_RIGHT,T_LEFT };
  32.  
  33. enum SIZES  { S_UNSPEC,S_Base16,S_Base4,S_Base,S_4Base,S_16Base,S_Over };
  34.  
  35. /* Default taken when no size parameter given */
  36. #define S_DEFAULT S_Base16
  37.  
  38. struct _implane
  39.  {dim  mwidth,mheight,
  40.        iwidth,iheight;
  41.   uBYTE *im;
  42.  };
  43. typedef struct _implane implane;
  44.  
  45.  
  46. enum ERRORS readplain();
  47. void planealloc();
  48. void interpolate();
  49. void readhqt();
  50. void decode();
  51.  
  52. /* copied from hpcdtoppm.h (0.4) */
  53. enum   CORR   { C_UNSPEC,C_LINEAR,C_DARK,C_BRIGHT,C_NeXT };
  54. /* color.c - copied from version 0.4 */
  55. extern void         colconvert();
  56. /* main_var04.c - this allows pCD.app to plug in color.c */
  57. extern void         init_hpcd_04();
  58. extern void         mainSetGammaCorr();  /* type CORR */
  59. extern void         mainSetSharpit();    /* type BOOL */
  60.  
  61.  
  62. static uBYTE sbuffer[SECSIZE];
  63.  
  64. static FILE *fin=0;
  65. #define SEEK(x) { if (fseek(fin,((x) * SECSIZE),0)) error(E_READ);}
  66.  
  67. #define EREADBUF {if(READBUF < 1) error(E_READ);}
  68.  
  69. #define SKIP(n)  { if (fseek(fin,(n),1)) error(E_READ);}
  70. #define SKIPr(n) { if (fseek(fin,(n),1)) return(E_READ);}
  71.  
  72. #define READBUF   fread(sbuffer,sizeof(sbuffer),1,fin)
  73. /*  Alternate version of READBUF for some NeXT processing: */
  74. #define READBUF_NeXT   fread(sbuffer,sizeof(sbuffer),1,NeXT_fin)
  75.  
  76. #define xTRIF(x,u,o,a,b,c) ((x)<(u)? (a) : ( (x)>(o)?(c):(b)  ))
  77. #define xNORM(x) x=TRIF(x,0,255,0,x,255)
  78. #define NORM(x) { if(x<0) x=0; else if (x>255) x=255;}
  79.  
  80. #define melde(x)
  81.  
  82. /* format of some of the records on a photo CD */
  83. /*  ph0 = header overview (from Hugo Burm) */
  84. struct ph0
  85. {
  86.     char id0[8];
  87.     uBYTE www1[2];
  88.     short num_thumbs;
  89.     uBYTE www2[(SECSIZE-12)];
  90. };
  91.  
  92. /* ph1 = not completely sure of the format of this yet */
  93. struct ph1 
  94.  {char id1[8];
  95.   char ww1[14];
  96.   char id2[20];
  97.   char id3[4*16+4];
  98.   short ww2;
  99.   char id4[20];
  100.   char ww3[2*16+1];
  101.   char id5[4*16];
  102.   char idx[11*16];
  103.  } ;
  104.  
  105.